<template>
    <el-result
            icon="warning"
            title="请您先完成实名认证"
    >
        <template #extra>
            <!--      <span class="example-demonstration">选择证件类型：</span>-->
            <el-select v-model="cert_type" placeholder="Select">
                <el-option
                        v-for="item in cert_type_options"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                />
            </el-select>
            <el-button type="primary" @click="to_verify_url" style="margin-left: 20px;">去认证</el-button>
        </template>
    </el-result>
</template>

<script>
    import {get_person_verify_url} from "@/request/api";
    import {return_url} from "@/assets/return_url";

    export default {
        name: "PersonVerify",
        data() {
            return {
                certified: false,
                cert_type: '0',
                return_url: return_url,
                cert_type_options: [{'value': '0', 'label': '居民身份证'}],
                // cert_type_options: [{'value': '0', 'label': '居民身份证'}, {'value': '1', 'label': '护照'}]
            }
        },
        methods: {
            async to_verify_url() {
                const res = await get_person_verify_url({cert_type: this.cert_type, return_url: this.return_url})
                console.log('res', res);
                const url = res.url
                window.location.href = url;
            }
        }
    }

</script>

<style scoped>
    .el-result {
        margin-top: 80px;
    }
</style>
